package engine.colliders;

import engine.entities.Entity;
import engine.entities.Spatial;

public abstract class AABBCollisionResolver implements CollisionResolver {

	@Override
	public boolean precondMet(Entity a, Entity b) {
		Spatial sa = a.getSpatial();
		float ax = sa.getX();
		float ay = sa.getY();
		float aw = sa.getWidth();
		float ah = sa.getHeight();

		Spatial sb = b.getSpatial();
		float bx = sb.getX();
		float by = sb.getY();
		float bw = sb.getWidth();
		float bh = sb.getHeight();

		if (ah + ay < by || aw + ax < bx || ay > bh + by || ax > bw + bx) {
			return false;
		}
		return true;
	}
}
